Import('env')

VariantDir('build-user', '.', duplicate = 0)
VariantDir('build-kernel', '.', duplicate = 0)

objects = Split('libnvpair.c nvpair.c nvpair_alloc_fixed.c nvpair_alloc_system.c')

objects_user = ['build-user/' + o for o in objects]
objects_kernel = ['build-kernel/' + o for o in objects]

cpppath_user = Split('./include #lib/libsolcompat/include')
cpppath_kernel = Split('./include #lib/libumem/include #lib/libnvpair/include1 #lib/libsolcompat/include')

ccflags_kernel = ['-D_KERNEL']

env.StaticLibrary('libnvpair-user', objects_user, CPPPATH = env['CPPPATH'] + cpppath_user)
env.StaticLibrary('libnvpair-kernel', objects_kernel, CPPPATH = env['CPPPATH'] + cpppath_kernel, CCFLAGS = env['CCFLAGS'] + ccflags_kernel)
